#include <func.h>

int main(){
    int fd = open("file1", O_RDWR);
    ERROR_CHECK(fd, -1, "open");
    struct stat statbuf;
    fstat(fd, &statbuf);
    //先获取md5码
    unsigned char md5[16];
    char md[100] = {0};
    char *q = md;
    char *p = (char *)mmap(NULL, statbuf.st_size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
    MD5((unsigned char *)p, statbuf.st_size, md5);
    for(int i = 0; i < 16; i++){
        sprintf(q, "%02x", md5[i]);
        q += 2;
    }
    return 0;
}

